using System;

namespace Calc
{
    public class Token
    {
        //存放代表Token的字符串
        public virtual string Value { get; set; }

        public Token() { }
        public Token(string value)
        {
            Value = value;
        }

        public override string ToString()
        {
            return Value;
        }
    }

    /// <summary>
    /// 数字
    /// </summary>
    public class NumberToken : Token
    {
        public double Number { get; set; }

        public NumberToken(string text) : base(text)
        {
            this.Number = Double.Parse(text);
        }

        
    }

    /// <summary>
    /// 操作符
    /// </summary>
    public class OperatorToken : Token
    {
        public virtual int Priority { get; set; }


    }


    public class AddToken : OperatorToken
    {
        public override int Priority { get; set; } = 1;
        public override string Value { get; set; } = "+";

    }
    public class SubtractToken : OperatorToken
    {
        public override int Priority { get; set; } = 1;

        public override string Value { get; set; } = "-";
    }

    public class MultipyToken : OperatorToken
    {
        public override int Priority { get; set; } = 2;

        public override string Value { get; set; } = "*";
    }

    public class DivideToken : OperatorToken
    {
        public override int Priority { get; set; } = 2;

        public override string Value { get; set; } = "/";
    }

    /// <summary>
    /// 括号
    /// </summary>
    public class ParensToken : Token
    {

    }

    /// <summary>
    /// 左括号
    /// </summary>
    public class LeftParensToken : ParensToken
    {
        public override string Value { get; set; } = "(";
    }

    /// <summary>
    /// 右括号
    /// </summary>
    public class RightParensToken : ParensToken
    {
        public override string Value { get; set; } = ")";
    }


}
